package com.aspose.words.maven.examples;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;


public class AsposeExampleWizard extends Wizard implements INewWizard {		
	
	private AsposeExampleWizardPage wizardPage;
	
	public AsposeExampleWizard() {
		setWindowTitle("Aspose.Words Code Example");
	}

	@Override
	public void init(IWorkbench workbench, IStructuredSelection selection) {

	}
	
	@Override
	public void addPages() {		
		super.addPages();	    	   	    
		wizardPage = new AsposeExampleWizardPage();	    	   	 		 
	    addPage(wizardPage); 	    	    	    
	}

	@Override
	public boolean performFinish() {		
		String selectedProjectPath = wizardPage.getSelectedProjectPath();
		String exampleCategory = wizardPage.getSelectedExampleCategory();
		IProject project = wizardPage.getIProject();
		AsposeExampleSupport.createExample(selectedProjectPath, exampleCategory, project);		
		return true;
	}	

}
